#ifndef _ECM_TYPES_H_
#define _ECM_TYPES_H_

#ifndef _WIN32

#include <sys/types.h>

#ifdef HAVE_INTTYPES_H

typedef int8_t		ecm_int8;
typedef int16_t		ecm_int16;
typedef int32_t		ecm_int32;
typedef int64_t		ecm_int64;

typedef u_int8_t	ecm_uint8;
typedef u_int16_t	ecm_uint16;
typedef u_int32_t	ecm_uint32;
typedef u_int64_t	ecm_uint64;

#else

typedef __int8_t	ecm_int8;
typedef __int16_t	ecm_int16;
typedef __int32_t	ecm_int32;
typedef __int64_t	ecm_int64;

typedef __uint8_t	ecm_uint8;
typedef __uint16_t	ecm_uint16;
typedef __uint32_t	ecm_uint32;
typedef __uint64_t	ecm_uint64;

#endif

typedef double		ecm_double;

typedef void *			ecm_ptr_t;
typedef const void *		ecm_cptr_t;
#if defined(ECM_ARCH_X86_64) || defined(__x86_64__)
typedef ecm_int64		ecm_iptr_t;
typedef ecm_uint64		ecm_uptr_t;
#else
typedef ecm_int32		ecm_iptr_t;
typedef ecm_uint32		ecm_uptr_t;
#endif

#define ECM_ATTRIBUTE_PACKED	__attribute__ ((packed))

#else

typedef __int8			ecm_int8;
typedef __int16			ecm_int16;
typedef __int32			ecm_int32;
typedef __int64			ecm_int64;

typedef unsigned __int8		ecm_uint8;
typedef unsigned __int16	ecm_uint16;
typedef unsigned __int32	ecm_uint32;
typedef unsigned __int64	ecm_uint64;

typedef double			ecm_double;
typedef void *			ecm_ptr_t;
typedef const void *		ecm_cptr_t;
typedef ecm_int64		ecm_iptr_t;
typedef ecm_uint64		ecm_uptr_t;

#define ECM_ATTRIBUTE_PACKED	__declspec(align(1))

#endif

#define ECM_SIZE_MAX		0x8fffffff

typedef float		ecm_float32;
typedef double		ecm_float64;
typedef ecm_uint32	ecm_size_t;

#endif
